package com.study.mapper;

import com.study.entity.ImgResource;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface ImgResourceMapper {
    /**
     * 根据活动id获取图片
     * @param activityId
     * @return
     */
    @Select("select * from img_resource where activity_id = #{activityId}")
    List<ImgResource> getActivityImageList(Long activityId);

    /**
     * 根据活动id获取图片 返回第一张
     * @param activityId
     * @return
     */
    @Select("select * from img_resource where activity_id = #{activityId} ORDER BY sort limit 1")
    ImgResource getActivityImageById(Long activityId);

    /**
     * 根据条件获取活动图片
     * @param map
     * @return
     */
    List<ImgResource> getActivityImageListByMap(Map map);
}
